package com.heima.controller;

import com.heima.service.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/order-service/report")
@Api(tags = "表单管理")
public class ReportController {

    @Autowired
    private ReportService reportService;

    @GetMapping("/orderCount")
    @ApiOperation("当月订单总量")
    public Integer getOrderCountByMonth(@RequestParam String start,
                                   @RequestParam String end){
        Integer count = reportService.getOrderCountByMonth(start,end);
        return count;
    }

    @GetMapping("/orderAmount")
    @ApiOperation("当月销售额")
    public Integer getOrderAmountByMonth(@RequestParam String start,
                                         @RequestParam String end){
        Integer amount = reportService.getOrderAmountByMonth(start,end);
        return amount;
    }
}
